Package edu.gatech.math2605.kzhou33.client

Source Code of edu.gatech.math2605.kzhou33.client.FreqPopup

package edu.gatech.math2605.kzhou33.client;

import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.ScrollPanel;

public class FreqPopup extends PopupPanel {
  ScrollPanel sp = new ScrollPanel();
  Grid g;

  public FreqPopup(int[] freq) {
    g = new Grid(freq.length + 1, 2);
    g.setText(0, 0, "Hits");
    g.setText(0, 1, "Frequency");
    for (int i = 1; i < g.getRowCount(); i++) {
      g.setText(i - 1, 0, (i-1) + "");
      g.setText(i - 1, 1, freq[i - 1] + "");
    }
    sp.add(g);
    add(sp);
  }

  public void update(int[] freq) {
    for (int i = 1; i < g.getRowCount(); i++) {
      g.setText(i, 0, i + "");
      g.setText(i, 1, freq[i - 1] + "");
    }
  }

}
TOP

Related Classes of edu.gatech.math2605.kzhou33.client.FreqPopup

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.